package main

import (
	"context"
	"fmt"
	trpc "git.code.oa.com/trpc-go/trpc-go"
	pb "git.woa.com/v_anxiong/test_trpcproto/product"
)

func main() {
	s := trpc.NewServer()
	fmt.Println(s)
	pb.RegisterProdServiceService(s.Service("trpc.anxiong.product"), &productImpl{})
	err := s.Serve()
	if err != nil {
		fmt.Println("错误", err)
	}
}

type productImpl struct {
	pb.UnimplementedProdService
}

func (p *productImpl) GetProductStock(ctx context.Context, req *pb.ProductRequest) (*pb.ProductResponse, error) {
	fmt.Println("显示请求的参数", req)
	rsp := &pb.ProductResponse{
		ProdStock: 2,
	}
	return rsp, nil
}
